<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="__PUBLIC__/Css/public.css"/>
    <style>

        .add_role {
            display: inline-block;
            width: 100px;
            line-height: 28px;
            text-align: center;
            border: 1px solid blue;
            border-radius: 4px;
            background-color: #9aafe5;
            cursor: pointer;

        }
    </style>


    <title>Title</title>
    <script src="__PUBLIC__/Js/jquery-1.7.2.min.js"></script>
    <script>
        $(function () {
            $('.add_role').click(function () {
                var obj = $(this).parents('tr').clone();
                obj.find('.add_role').remove();
                $('#last').before(obj);
            })

        })
    </script>
</head>
<body>
<form action="{:U('admin/rbac/adduser_post')}" method="post">
    <table class="table">
        <tr>
            <th colspan="2">添加用户</th>
        </tr>
        <tr>
            <td> 用户名称</td>
            <td style="text-align: left"><input type="text" name="username">
            </td>
        </tr>
        <tr>
            <td>密码</td>
            <td style="text-align: left"><input type="password" name="userpwd"></td>
        </tr>
        <tr>
            <td>选择角色</td>
            <td style="text-align: left ;">
                <select name="role_id[]" id="select1" style="">
                    <foreach name="roles" item="vo">
                        <option value="{$vo.id}">{$vo.name}</option>
                    </foreach>
                </select>
                <span class="add_role">添加一个角色</span>

            </td>
        </tr>
        <tr id="last">
            <td colspan="2" style="text-align: center">
                <input style="background-color: #2E6AB1 ;color: gainsboro " type="submit" value="提交">
            </td>
        </tr>
    </table>
</form>
</body>
</html>